<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../js/vue.js"></script>
</head>
<body>
    <div id="root">
        <app>
            
        </app>
        
    </div>

    <!-- v-bind: 可以简写成 : -->


    <script>
        Vue.config.productionTip = false;

        // 创建student组件
        const student = Vue.extend({
            template:`
                <div>
                    <h2>
                        姓名: <h2>{{studentName}}</h2>
                        年龄: <h2>{{age}}</h2>
                    </h2>
                </div>`,
            data(){
                return {
                    studentName:'李四',
                    age:24,
                }
            }
        })
        // 创建school组件
        const school = Vue.extend({
            template:`
                <div>
                    <h2>学校:{{schoolName}}</h2>
                    <h2>地址:{{address}}</h2>
                    <student></student>
                </div>`,
            data(){
                return {
                    schoolName:'北邮',
                    address:'北京',
                }
            },
            methods: {
                
            },
            components:{
                student
            }
        })

        const app = Vue.extend({
            template:`
                <div>
                    <school></school>
                </div>
            `,
            components:{
                school,
            }
        })
        
        // 创建vm
        new Vue({
            el: '#root',
            // template:`<app></app>`,
            // 注册组件
            components:{
                // key:value  k可以随意，value必须和组件对应
                app, 
            }
        })
    </script>

</body>
</html>